<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        var obj1 = {
            name : 1,
            getName: function() {
                console.log(this.name);
            }
        }
        var obj2 = {
            name : 2,
            getName: function() {
                console.log(this.name);
            }
        }
        var getName1 = obj1.getName
        var getName2 = obj2.getName

        console.log(getName1());
        console.log(obj1.getName());
        console.log(getName1.call(obj2));
        console.log("----------------------");
        console.log(getName2());
        console.log(obj2.getName());
        console.log(getName2.call(obj1));
    </script>
</body>
</html>